package com.ITD.controller;

import com.ITD.pojo.LoginParam;
import com.ITD.service.LoginService;
import com.ITD.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api(tags = "登录相关接口")
@RestController
@RequestMapping("/login")
public class LoginController {
    @Autowired
     private LoginService loginService;

    @ApiOperation("登录")
//    @ApiImplicitParam(dataType = "LoginParam" ,name = "loginParam",value = "登录参数",required = true)
    @Parameter(name = "loginParam", description = "登录参数", required = true)
    @PostMapping
    public Result login(LoginParam loginParam){//json类数据传入自动组装，不需要注解
        //封装数据
       // LoginParam loginParam =new LoginParam(username,password);
        return loginService.login(loginParam);
    }


    @ApiOperation("测试登录")
    @GetMapping
    public String login2(){ //测试接收

        return "ok";
    }
}
